
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>html5</title>
</head>
<body  > 
    <button >下载excel</button>
    <button >下载cvs</button>
    <button >JPG</button>
    <button >js文件</button>
</body></html>

<script>

function evil(fn) {
    var Fn = Function;  //一个变量指向Function，防止有些前端编译工具报错
    return new Fn('return ' + fn)();
}

function eval1 (str) {
    var script = document.createElement('script');
    script.type="text/javascript";
    script.text=str;
    document.getElementsByTagName('head')[0].appendChild(script);
    document.head.removeChild(document.head.lastChild);
}

{
    var blob="666\setwert\r\nasdadadsa\r5464646\nasdadad";
    var lHtml = "<table border='1' style='width: 750px;height: 242px; border:1px solid ;border-collapse: collapse;border-color:#000;background-color:white;' align='center'><tr style='border: 0px;'><td colspan='5' style='height: 50px;font-size:21px;text-align: center;border: 0px;font-weight: bold;'>�豸XXXXX����</td></tr></table>"

    var tableHtml='<html><head><meta charset="UTF-8"></head><body>';
tableHtml += lHtml;
tableHtml += '</body></html>';



    if (window.navigator.msSaveOrOpenBlob) {
        //兼容IE
    navigator.msSaveBlob(blob, "download.xls");
    }else{
    const bdata = new Blob([tableHtml], { type: 'application/vnd.ms-excel,charset=UTF-8' });
    const link = document.createElement('a');
    link.href = window.URL.createObjectURL(bdata);
    link.download = "download.xls";
    document.body.append(link);
    link.click();
    window.URL.revokeObjectURL(link.href);
    document.body.removeChild(link);
    }
}
</script>
